package modular.demo1;


import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class FlowBean implements Writable {

    private int upFlow;
    private int downFlow;
    private int amountFlow;
    private String phone;

    public FlowBean() {

    }

    public FlowBean(int upFlow, int downFlow, int amountFlow, String phone) {
        this.upFlow = upFlow;
        this.downFlow = downFlow;
        this.amountFlow = amountFlow;
        this.phone = phone;
    }

    public int getUpFlow() {
        return upFlow;
    }

    public void setUpFlow(int upFlow) {
        this.upFlow = upFlow;
    }

    public int getDownFlow() {
        return downFlow;
    }

    public void setDownFlow(int downFlow) {
        this.downFlow = downFlow;
    }

    public int getAmountFlow() {
        return amountFlow;
    }

    public void setAmountFlow(int amountFlow) {
        this.amountFlow = amountFlow;
    }

    /*hadoop 系统在序列化该类的对象时要调用的方法*/
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt(upFlow);
        dataOutput.writeInt(downFlow);
        dataOutput.writeInt(amountFlow);
        dataOutput.writeUTF(phone);


    }

    /*hadoop 系统在 反 序列化该类的对象时要调用的方法*/
    public void readFields(DataInput dataInput) throws IOException {
        this.upFlow = dataInput.readInt();
        this.downFlow = dataInput.readInt();
        this.amountFlow = dataInput.readInt();
        this.phone = dataInput.readUTF();

    }

    @Override
    public String toString() {
        return "FlowBean{" +
                "upFlow=" + upFlow +
                ", downFlow=" + downFlow +
                ", amountFlow=" + amountFlow +
                ", phone='" + phone + '\'' +
                '}';
    }
}
